import request from '@/utils/request'

// 查询会员列表
export function listUser(query) {
  return request({
    url: '/member/user/list',
    method: 'get',
    params: query
  })
}

// 查询会员详细
export function getUser(memberId) {
  return request({
    url: '/member/user/' + memberId,
    method: 'get'
  })
}

// 新增会员
export function addUser(data) {
  return request({
    url: '/member/user',
    method: 'post',
    data: data
  })
}

// 修改会员
export function updateUser(data) {
  return request({
    url: '/member/user',
    method: 'put',
    data: data
  })
}

// 删除会员
export function delUser(memberId) {
  return request({
    url: '/member/user/' + memberId,
    method: 'delete'
  })
}

// 导出会员
export function exportUser(query) {
  return request({
    url: '/member/user/export',
    method: 'get',
    params: query
  })
}

// 重置密码
export function resetUserPwd(memberId, password) {
  const data = {
    memberId,
    password
  }
  return request({
    url: '/member/user/resetPwd',
    method: 'put',
    data: data
  })
}

// 会员状态修改
export function changeUserStatus(memberId, status) {
  const data = {
    memberId,
    status
  }
  return request({
    url: '/member/user/changeStatus',
    method: 'put',
    data: data
  })
}